<template>
  <div class="conn">
    <van-cell-group inset>
      <van-field
        label="任务"
        :model-value="task.taskName.toString()"
        readonly
      />
      <van-field
        label="权重占比"
        :model-value="task.Term_weight.toString()"
        disabled
      />
      <van-field
        label="截止时间"
        :model-value="task.deadline.toString()"
        disabled
      />
      <van-field label="得分" :model-value="task.score.toString()" disabled />
      <van-field label="评语" :model-value="task.comment.toString()" disabled />
    </van-cell-group>
  </div>
</template>

<script setup>
import { useRoute } from "vue-router";
import { onBeforeMount, ref } from "vue";

const route = useRoute();

const tasks = [
  {
    taskName: "开发初体验",
    Term_weight: 7.5,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "组件化开发",
    Term_weight: 20,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "路由的使用",
    Term_weight: 100,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "电影列表",
    Term_weight: 25,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "自动化测试",
    Term_weight: 25,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "状态管理pinia",
    Term_weight: 25,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
  {
    taskName: "使用UI组件库",
    Term_weight: 25,
    deadline: "2024/03/17 23:59:59\n",
    score: 95,
    comment: "",
  },
];
const course = route.query.course;
const task = ref(null);
onBeforeMount(() => {
  task.value = tasks.find((item) => item.taskName === course);
});
</script>

<style>
.conn {
  margin-top: 120px;
}
</style>
